package com.testdocs.client.structure.work_area;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.SplitLayoutPanel;
import com.google.gwt.user.client.ui.Widget;

public class WorkAreaPanelImpl extends Composite implements WorkAreaPanel {
	@UiTemplate("WorkAreaPanel.ui.xml")
	interface WorkAreaPanelUiBinder extends UiBinder<Widget, WorkAreaPanelImpl> {
	}

	private static WorkAreaPanelUiBinder uiBinder = GWT
			.create(WorkAreaPanelUiBinder.class);

	@UiField
	SplitLayoutPanel workAreaPanel;

	@UiField
	ScrollPanel main;

	@UiField
	LayoutPanel menuPanel;
	
	IsWidget menu;

	@SuppressWarnings("unused")
	private Presenter presenter;
	
	public WorkAreaPanelImpl() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public AcceptsOneWidget getMain() {
		return main;
	}

	@Override
	public void setMenu(IsWidget menu) {
		this.menu = menu;
		menuPanel.clear();
		menuPanel.add(menu);
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}
}
